﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Lead2012.Business
{
    public class ReportOperatorRepository
    {
        // Create an instance of entities framework
        Lead2012Entities entities = new Lead2012Entities();

        public ReportOperator GetSingle(int id)
        {
            return (from c in entities.ReportOperators where c.OperatorId == id select c).FirstOrDefault();
        }
        public void Create(ReportOperator _object)
        {
            entities.AddToReportOperators(_object);
            entities.SaveChanges();
        }
        public void Update(ReportOperator _object)
        {
            entities.SaveChanges();
        }
        public void Delete(int id)
        {
            var _object = (from _list in entities.ReportOperators where _list.OperatorId == id select _list).First();
            entities.DeleteObject(_object);
            entities.SaveChanges();
        }
    }
}